package com.vodone.v1pin.userInfo.delegate
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.model.MainModelLocator;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	
	import mx.rpc.http.mxml.HTTPService;
	
	public class CouponDelegate
	{
		public static function getRedCouponCanUseList( resultHandler:Function , money:Number, faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getRedCardService;
			var params:Object = {
				userId : MainModelLocator.getInstance().userLoginVO.userId,
				money : money
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		
		public static function getCouponList( resultHandler:Function , type:String = "" , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getCouponService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				type : type
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function activeCoupon( resultHandler:Function , couponCode:String , couponPwd:String , orderTotal:Number = -1 , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().activeCouponService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				couponCode : couponCode,
				orderTotal : orderTotal,
				couponPwd : couponPwd
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
	}
}